package com.hualan.sfzyproject.controller.User;

import com.github.pagehelper.PageInfo;
import com.hualan.sfzyproject.domain.PsyKnowledge;
import com.hualan.sfzyproject.mapper.PsyKnowledgeMapper;
import com.hualan.sfzyproject.service.PsyKnowledgeService;
import com.hualan.sfzyproject.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.websocket.server.PathParam;
import java.util.List;

@RestController
@RequestMapping("/psy")
public class PsyController {
    @Autowired
    private PsyKnowledgeService psyKnowledgeService;
    @Autowired
    private PsyKnowledgeMapper psyKnowledgeMapper;
    @GetMapping("/knowledge/page")
    public R getPsyKnowledge(Integer page, Integer pageSize) {
        PageInfo<PsyKnowledge> psyKnowledges = psyKnowledgeService.PsyKnowledgePageQuery(page, pageSize);
        return R.ok(psyKnowledges);
    }
    @GetMapping("/knowledge/detail/{id}")
    public PsyKnowledge getPsyKnowledgeDetail(@PathVariable("id") Long id) {
        PsyKnowledge psyKnowledge = psyKnowledgeMapper.selectById(id);
        return psyKnowledge;
    }
}
